#ifndef OBJMESH_H
#define OBJMESH_H

#include "Loader.h"
#include "BBox.h"

#include <vector>
#include <string>

class Ray;
class Intersection;


class ObjMesh
{
public:
    ObjMesh(const std::string &fileName, FurnitureType type = CHAIR);

    FurnitureType getType();

    std::string getName();

    bool hasTextureCoords();

    bool intersect(const Ray& ray, Intersection*);

    virtual void draw();

private:
    struct Face{
        Point3f* vertices[3];
        Vector3f* normals[3];
        Point2f* textureCoord[3];
    };

    std::string m_name;
    FurnitureType m_type;

    BBox m_bbox;

    std::vector<Point3f> vertices;
    std::vector<Vector3f> normals;
    std::vector<Point2f> textureCoord;
    std::vector<Face> faces;
    bool hasTextureCoord;

    int displayListId;
};

#endif

